clear 

use "/Users/vanessavandenboogaard/Dropbox/*AishaAhmad/DataReplication/AhmadSomData.dta"

/* 1 - residual, 2 TFG, 3 ICU, 4 none*/
tab polpreference

/* Ordinal: 1 very high, 2 high, 3 average, 4 low, 5 none*/

tab warlordtax
tab icutax

/*recode so that it is ascending: 1 none, 2 low, 3 average, 4 high, 5 very high*/

generate warlordtax2 = .
replace warlordtax2 = 1 if warlordtax == 5
replace warlordtax2 = 2 if warlordtax == 4
replace warlordtax2 = 3 if warlordtax == 3
replace warlordtax2 = 4 if warlordtax == 2
replace warlordtax2 = 5 if warlordtax == 1
tab warlordtax2

generate icutax2 = .
replace icutax2 = 1 if icutax == 5
replace icutax2 = 2 if icutax == 4
replace icutax2 = 3 if icutax == 3
replace icutax2 = 4 if icutax == 2
replace icutax2 = 5 if icutax == 1
tab icutax2

/*Ordinal - recode: strongly agree (1) --> 1, all else (2-5) --> 0*/
tab islamictrust
replace islamictrust = 0 if islamictrust == 2 | islamictrust == 3 | islamictrust == 4 | islamictrust == 5
tab islamictrust

tab islamiclaw
replace islamiclaw = 0 if islamiclaw == 2 | islamiclaw == 3 | islamiclaw == 4 | islamiclaw == 5
tab islamiclaw

/*Ordinal - recode: strongly agree or agree (1,2) --> 1, all else (3-5) --> 0*/

tab clantrustq1
replace clantrustq1 = 1 if clantrustq1 == 2
replace clantrustq1 = 0 if clantrustq1 == 3| clantrustq1 == 4 | clantrustq1 == 5
tab clantrustq1

tab clantrustq2
replace clantrustq2 = 1 if clantrustq2 == 2
replace clantrustq2 = 0 if clantrustq2 == 3| clantrustq2 == 4 | clantrustq2 == 5
tab clantrustq2

/*create composite variable of the two clan trust vars*/

egen clantrust = rowmean(clantrustq1 clantrustq2)
tab clantrust

/*size of business 
1 large, 2 medium, 3 small */
tab sizeofbus

/*recode size of business variable so that it is in ascending order*/
generate bussize = .
replace bussize = 1 if sizeofbus == 3
replace bussize = 2 if sizeofbus == 2
replace bussize = 3 if sizeofbus == 1
tab bussize

/*gender
 male 1, female 2*/
 
 tab male1female2
 
 /*create male var
 male 1, female 0*/
 
 generate male = .
 replace male = 1 if male1female2 == 1
 replace male = 0 if male1female2 == 2
 tab male
 
 /*Education
 1 secondary, 2 advanced, 3 religious, 4 none*/
 tab education
 
 generate highschool = .
 replace highschool = 1 if education == 1
 replace highschool = 0 if education == 2 | education == 3 | education == 4 | education == 5
 tab highschool
 
 generate university = .
 replace university = 1 if education == 2
 replace university = 0 if education == 1 | education == 3 | education == 4 | education == 5
 tab university
 
 generate religiouseducation = .
 replace religiouseducation = 1 if education == 3
 replace religiouseducation = 0 if education == 1 | education == 2 | education == 4 | education == 5
 tab religiouseducation
 
 /*multinomial logistic regression*/
 mlogit polpreference male bussize highschool university religiouseducation clantrust islamictrust islamiclaw icutax2 warlordtax2
  
 /*with risk ratios*/
 mlogit polpreference male bussize highschool university religiouseducation clantrust islamictrust islamiclaw icutax2 warlordtax2, rr

 
